<template>
	<view class="agent">
		<view class="user">
			
			
			<view class="text">
				<view class="name"><text>姓名：</text>{{initData.name}}</view>
				<view class="LV" ><text>等级：</text>{{initData.level}}</view>
				<view class="LV" v-if="initData.isOfficial==1"><text>邀请码：</text>{{initData.sn}}</view>
			</view>
			
			<view class="news" @click="_router('/pages/shop/news/msglist')">
				<image src="/static/img/information_1.png" />
				<text v-if="news_l">{{ news_l }}</text>
			</view>
			<image src="/static/img/my_bg.png" class="bg" />
		</view>
		<view class="list">
			<view class="line">
				<view class="list2 list-l bgf" @click="_router('./order/order')">
					<view class="fz-16">我的订单</view>
					<image src="/static/img/agent1.png" />
				</view>
				<view class="list2 list-r bgf" @click="_router('./order/claim')">
					<view class="fz-16">订单认领</view>
					<image src="/static/img/agent2.png" />
				</view>
			</view>
			<view class="line">
				<view class="list3 list-l  bgf" @click="_router('./order/seckillorder')">
					<view class="fz-16">秒杀订单</view>
					<image src="/static/img/agent3.png" />
				</view>
				<view class="list3 list-r bgf" @click="_router('./withdraw/withdrawlist')">
					<view class="fz-16">提现记录</view>
					<image src="/static/img/agent4.png" />
					<!-- <view class="list1 bgf" >
						
					</view> -->
				</view>
			</view>
			<view class="line">
				<view class="list2 list-l bgf" @click="_router('./placeorder/placeorder')">
					<view class="fz-16">代理下单</view>
					<image src="/static/img/agent6.png" />
				</view>
				<view class="list2 list-r bgf" @click="_router('./order/agentactorder')">
					<view class="fz-16">活动订单</view>
					<image src="/static/img/agent5.png" />
				</view>
			</view>
			<view class="line">
				<view class="list3 list-l bgf" @click="_router('./team/team')">
					<view class="fz-16">我的团队</view>
					<image src="/static/img/agent8.png" />
				</view>
				<view class="list3 list-r bgf" @click="_router('./performance')">
					<view class="fz-16">我的业绩</view>
					<image src="/static/img/agent9.png" />
				</view>
			</view>
			<view class="line">
				<view class="list3 list-l bgf" @click="_router('./advertising/classify')">
					<view class="fz-16">广告预约</view>
					<image src="/static/img/agent10.png" />
				</view>
				<view class="list3 list-r bgf" @click="_router('./statement/index')">
					<view class="fz-16">我的报表</view>
					<image src="/static/img/agent11.png" />
				</view>
			</view>
			<view class="line">
				<view class="list3 list-l bgf" @click="_router('./advertising/myreservation')">
					<view class="fz-16">我的预约</view>
					<image src="/static/img/agent7.png" />
				</view>
				<view class="list3 list-r bgf" @click="_router('./order/refuse')">
					<view class="fz-16">拒绝订单</view>
					<image src="/static/img/agent11.png" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { uniIcons } from '@dcloudio/uni-ui';
import my from '../../servers/shop/my.js';
export default {
	components: { uniIcons },
	data() {
		return {
			initData:'',
			participation: '0.00',
			id: null,
			news_l:0
		};
	},
	mounted() {
		this.getDate() 
	},
	onLoad(option) {
		if(option.obj){
			this.initData=JSON.parse(option.obj)
			
		}
		
	},
	onShow() {
		this.initData=JSON.parse(uni.getStorageSync('agentinfo'))
	},
	onBackPress(e) {  
	// 这里可以自定义返回逻辑，比如下面跳转其他页面
		uni.switchTab({
			url:'../shop/my'
		})
		// return true 表示禁止默认返回
		 return true
	},
	methods: {
		tip(){
			uni.showToast({
				title:'功能暂未开放，请期待···',
				icon:'none'
			})
		},
		getDate() {
			var _this=this;
			uni.showLoading({
				title: '加载中',
				mask: true
			});
			
			my.noReadMessage()
				.then(res => {
					_this.news_l = res.data;
				})
				.catch(err => {
					console.log(new Error('请检查网络后重试'));
				});
		},
		_router(router) {
			uni.navigateTo({
			    url: router
			});
		},
		back(e) {
			uni.navigateBack({
			    delta: 1
			});
		}
	}
};
</script>

<style lang="less" scoped>
.agent {
	overflow: auto;
	height: 100vh;
	background-color: #f5f5f5;
	.user {
		position: relative;
		color: #fff;
		padding: var(--status-bar-height) 20rpx 0;
		display: flex;
		overflow: hidden;
		z-index: 9;
	
		.text {
			padding: 32rpx 25rpx;
			font-size: 30rpx;
			.LV {
				margin-top: 25rpx;
			}
			text{
				display: inline-block;
				width: 120rpx;
			}
		}
		
		.news {
			position: absolute;
			right: 0;
			top: 70rpx;
			image {
				width: 43rpx;
				height: 43rpx;
				padding: 7rpx 20rpx;
			}
			text {
				position: absolute;
				top: -3rpx;
				right: 6rpx;
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				text-align: center;
				line-height: 30rpx;
				background: #fff;
				font-size: 24rpx;
				color: #ff2100;
			}
		}
		.bg {
			position: absolute;
			width: 100%;
			height: 100%;
			top: 0;
			left: 0;
			z-index: -1;
		}
	}
	
	
	
	
	
	
	
	
	
	
	.top {
		position: relative;
		background: linear-gradient(80deg, #ff084e, #fa5d7e);
		color: #fff;
		text-align: center;
		padding-bottom: 37rpx;
		.left{
			position: absolute;
			top: 40rpx;
			left: 0;
			width: 40px;
			height: 40px;
			line-height: 40px;
		}
		.sum {
			padding: 93rpx 0;
			width: fit-content;
			margin: 0 auto;
			.number {
				font-size: 60rpx;
			}
			.text {
				margin-top: 30rpx;
				font-size: 32rpx;
				image {
					position: relative;
					top: 2rpx;
					left: 15rpx;
					width: 22rpx;
					height: 26rpx;
					margin-right: 26rpx;
				}
			}
		}
		.detail {
			display: flex;
			width: 100%;
			padding-bottom: 47rpx;
			.arrange {
				flex: 1;
				.number {
					font-size: 42rpx;
				}
				.text {
					font-size: 26rpx;
					margin: 27rpx 0;
				}
			}
		}
		.withdraw {
			font-size: 34rpx;
			background: #fff;
			color: #f70225;
			width: 237rpx;
			height: 84rpx;
			border-radius: 42rpx;
			line-height: 84rpx;
			margin: 0 auto;
		}
	}
	.list {
		padding: 51rpx 20rpx;
		.line {
			display: flex;
			width: 100%;
			margin-bottom: 21rpx;
			.bgf {
				width: 100%;
				background: #fff;
			}
			.list-r {
				width: 100%;
				margin-left: 24rpx;
			}
			.list1 {
				position: relative;
				height: 139rpx;
				view {
					padding: 36rpx 33rpx;
				}
				image {
					position: absolute;
					right: 25rpx;
					top: 42rpx;
					width: 90rpx;
					height: 90rpx;
				}
			}
			.list2 {
				position: relative;
				height: 215rpx;
				flex: 1;
				display: flex;
				// justify-content: space-between;
				align-items: center;
				view {
					padding: 46rpx 33rpx;
				}
				image {
					position: absolute;
					right: 25rpx;
					top: 100rpx;
					width: 90rpx;
					height: 90rpx;
				}
			}
			.list3.bgf {
				position: relative;
				height: 303rpx;
				view {
					padding: 53rpx 33rpx;
				}
				image {
					position: absolute;
					right: 25rpx;
					bottom: 52rpx;
					width: 90rpx;
					height: 90rpx;
				}
			}
			.list3 .list1:nth-child(1) {
				margin-bottom: 21rpx;
			}
		}
	}
}
.agent .list .line .list2,.agent .list .line .list3{
	height: 60px;
}
.agent .list .line .list2 uni-image,.agent .list .line .list3 uni-image,.agent .list .line .list1 uni-image{
	width: 30px;
	height: 30px;
	top: 50%;
	margin-top: -15px;
}
.agent .list .line .list3.bgf{
	display: flex;
	align-items: center;
	height: 60px;
}
.agent .list .line .list3.bgf uni-image{
	width: 30px;
	height: 30px;
	top: 50%;
	margin-top: -15px;
}
.fz-16{
	font-size: 16px;
}
</style>
